//
//  NetWorkTask.m
//  UI16_PackageNetWork
//
//  Created by 刘珊珊 on 15/11/16.
//  Copyright (c) 2015年 刘珊珊. All rights reserved.
//

#import "NetWorkTask.h"

@implementation NetWorkTask

+ (void)sendRequestWithGet:(NSURL *)url withResult:(void(^)(id result))block{
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        id result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
        block (result);
    }];
}

@end
